@extends('manage.layout')

@section('content')
    <section class="content-header">
        <h1>
           客户反馈
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">MemberToCao</a></li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <a href="/member/getTuCaoList"  @if($typeid == '') class="btn btn-info" @else class="btn btn-default" @endif style="margin: 0 20px 0 0">全部</a>
                        @foreach($toCaoType as $value)
                            <a href="/member/getTuCaoList?type={{$value['id']}}&status={{$statusid}}" @if($typeid == $value['id']) class="btn btn-info" @else class="btn btn-default" @endif style="margin: 0 20px 0 0">{{$value['name']}}</a>
                        @endforeach
                        @foreach($toCaoStatus as $value)
                            <a href="/member/getTuCaoList?type={{$typeid}}&status={{$value['id']}}" @if($statusid == $value['id']) class="btn btn-info" @else class="btn btn-default" @endif style="margin: 0 20px 0 0">{{$value['name']}}</a>
                        @endforeach
                            <a href="/member/TuExcel"   @if($typeid == '') class="btn btn-info" @else class="btn btn-default" @endif style="margin: 0 20px 0 0">导出数据</a>
                        {{--<h3 class="box-title">内容</h3>--}}
                        <span style="float:right;color: #bbb">共{{$count}}条结果</span>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table id="example2" class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>吐槽人</th>
                                <th>
                                    添加时间&nbsp;&nbsp;
                                    <a href="/member/getTuCaoList?type={{$typeid}}&status={{$statusid}}&orderBy=1"><i class="fa fa-arrow-up"></i></a>&nbsp;
                                    <a href="/member/getTuCaoList?type={{$typeid}}&status={{$statusid}}&orderBy=2"><i class="fa fa-arrow-down"></i></a>
                                </th>
                                <th>类型</th>
                                <th>描述</th>
                                <th>建议解决方案</th>
                                <th>解决方案</th>
                                <th>解决人</th>
                                <th>状态</th>
                                <th>解决时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($list as $p)
                                <tr>
                                    <td>{{ $p['id'] }}</td>
                                    <td>{{ $p['mem_nickname'] }}</td>
                                    <td>{{ $p['add_time_str'] }}</td>
                                    <td>{{ $p['type_str'] }}</td>
                                    <td>{{ $p['problem_content'] }}</td>
                                    <td>{{ $p['advise_solve_content'] }}</td>
                                    <td><input type="text" value="{{ $p['solve_content'] }}" style="width:400px;" onchange="upSolve({{$p['id']}},this)"/></td>
                                    <td>{{ $p['solve_mem_nickname'] }}</td>
                                    <td>{{ $p['status_str'] }}</td>
                                    <td>{{ $p['solve_time_str'] }}</td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                    <div style="text-align: center;">
                        {!! $list->appends(['type'=>$typeid,'orderBy'=>$orderBy,'count'=>$count,'status'=>$statusid])->links() !!}
                    </div>
                </div>
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
@stop
@section('script')
	<script>
        function upSolve(id,t) {
            var solve_content = $(t).val();
            $.ajax({
                url: '/member/upTuCao',
                type: "post",
                data: {solve_content:solve_content,id:id,'_token':'{{csrf_token()}}'},
                dataType: "json",
                success: function(res) {
                    console.log(res);
                    if(res.error == 0) {
                        td1 = $(t).parent("td").next("td");
                        td1.text(res.data.solve_mem_str);
                        td1.next("td").text(res.data.status);
                        td1.next("td").next("td").text(res.data.solve_time);
                        layer.msg(res.msg)
                    }
                    else {
                        layer.msg(res.msg)
                    }
                }
            });
        }
        function getContent(_content){
//            //页面层
//            layer.open({
//                type: 1,
//                skin: 'layui-layer-rim', //加上边框
//                area: ['420px', '240px'], //宽高
//                content: _content
//            });
            //自定页
            layer.open({
                type: 1,
                title:'反馈内容（点击阴影处关闭）',
                skin: 'layui-layer-molv', //样式类名
                closeBtn: 0, //不显示关闭按钮
                area: ['420px', '240px'], //宽高
                anim: 2,
                shadeClose: true, //开启遮罩关闭
                content: _content
            });
        }
	</script>
@stop
